"""
08-Socket客户端开发
"""
import socket

# 创建socket对象
socket_client = socket.socket()

# 连接到服务器
socket_client.connect(('127.0.0.1', 9009))

while True:
    msg = input("请输入要发送给服务端的消息：")
    if msg == 'exit':
        break
    socket_client.send(msg.encode('utf-8'))
    recv_data = socket_client.recv(1024)
    print(f"服务端回复的消息是:{recv_data.decode('utf-8')}")

socket_client.close()
